<template>
  <van-nav-bar title="列表" />
  <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
    <van-list
      v-model:loading="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
    <router-link v-for="item in list" :to="'/detail/'+item.goods_id">
         <van-card
        :price="item.goods_price"
        :title="item.goods_name"
        :thumb="
          item.goods_big_logo
            ? item.goods_big_logo
            : 'https://tse2-mm.cn.bing.net/th/id/OIP-C.wvYWXhrPa5hqIOi2dvE73QHaEo?rs=1&pid=ImgDetMain'
        "
      />
    </router-link>
     
    </van-list>
  </van-pull-refresh>
</template>

<script setup>
import { ref } from "vue";
import { goodsApi } from "@/api/api";
import { useRoute } from "vue-router";
let route = new useRoute();

const list = ref([]);
const goodsData = () => {
  goodsApi(route.params.cat_id).then((res) => {
    console.log("列表数据", res);
    list.value = res.data.message.goods;
  });
};
goodsData();
</script>

<style lang="scss" scoped></style>
